/*
 * Copyright (c) 2020-2021, SERI Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2021-10-29     Lyons        first version
 */

#include "__def.h"
#include "xprintf.h"

extern void timer1_handler(void);

void trap_handler(uint32_t irqno, uint32_t epc)
{
#ifdef OS_ENABLE_RT_THREAD
    extern void rt_enter_critical(void);
    rt_enter_critical();
#endif

    if ( irqno & (1<<31) ) {
        timer1_handler();
    }

#ifdef OS_ENABLE_RT_THREAD
    extern void rt_exit_critical(void);
    rt_exit_critical();
#endif
}